package com.yygo.jobs;

import com.yygo.model.LoanRequest;
import com.yygo.model.Rule;
import com.yygo.service.LoanRequestManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Created by tiansha on 2015/7/9.
 */
@Component("F008")
public class F008 extends BaseRuleProcessor implements RuleProcessor {

    @Autowired
    private LoanRequestManager loanRequestManager;

    @Override
    public Rule process(LoanRequest loanRequest) {
        String province = loanRequest.getDealer().getProvince();
        if (!province.equals(loanRequest.getRequestPerson().getIdProvince())) {
            List<LoanRequest> list = getIdentityAddressRequests(loanRequest);
            if (list.size() > 0) {
                Rule rule = new Rule("F008", "该客户与关联单客户来自于同一地区");
                rule.setUrl("related");
                List<String> numbers = getNumbers(list);
                rule.getNumbers().addAll(numbers);
                return rule;
            }
        }
        return null;
    }
}
